import {stringify} from 'qs';
import request from '@/utils/request';

export async function queryEmp(params) {
  return request(`/api/v1/employees?${stringify(params)}`);
}

export async function resetPwd(params) {
  return request('/api/v1/employees/resetPwd', {
    method: 'POST',
    body: {
      ...params
    },
  });
}

export async function remove(params) {
  return request('/api/v1/employees', {
    method: 'DELETE',
    body: {
      ...params
    },
  });
}

export async function saveOrUpdate(params) {
  return request('/api/v1/employees/saveOrUpdate', {
    method: 'POST',
    body: {
      ...params
    },
  });
}

export async function queryRole(params) {
  return request(`/api/v1/role/queryList?${stringify(params)}`)
}

export async function queryEmployeeRole(params) {
  return request(`/api/v1/employees/queryEmployeeRole?${stringify(params)}`)
}

export async function saveEmployeeRole(params) {
  let roles = params.roles;
  return request(`/api/v1/employees/${params.id}/saveEmployeeRole`, {
    method: 'POST',
    body: roles,
  });
}

